<template>
  <div>
    <div>今天:{{ today.format('YYYY-MM-DD') }}</div>
    <div>上个月开始日期: {{ startDate }}</div>
    <div>上个月结束日期: {{ endDate }}</div>
  </div>
</template>

<script setup>
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')

const today = dayjs()
// 获取上个月开始日期
let startDateOfMonth = today.subtract(1, 'month').startOf('month')
let startDate = startDateOfMonth.format('YYYY-MM-DD')
let endDate = startDateOfMonth.endOf('month').format('YYYY-MM-DD')
</script>
